package beanstao.util.setting;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

import net.sf.json.JSONObject;

import com.google.common.collect.Maps;

public class SettingCollection implements Map<String, Setting<?>>
{
	private final Map<String, Setting<?>> _ModuleSettingMap = Maps.newLinkedHashMap();

	@Override
	public void clear()
	{
		_ModuleSettingMap.clear();
	}

	@Override
	public boolean containsKey(Object key)
	{
		for (String keys : _ModuleSettingMap.keySet())
			if (_ModuleSettingMap.containsKey(keys))
				return true;
		return false;
	}

	@Override
	public boolean containsValue(Object value)
	{
		for (String keys : _ModuleSettingMap.keySet())
			if (value.equals(_ModuleSettingMap.get(keys)))
				return true;
		return false;
	}

	@Override
	public Set<java.util.Map.Entry<String, Setting<?>>> entrySet()
	{
		return null;
	}

	@Override
	public Setting<?> get(Object key)
	{
		return _ModuleSettingMap.get(key);
	}

	@Override
	public boolean isEmpty()
	{
		if (_ModuleSettingMap.isEmpty())
			return false;
		else
			return true;

	}

	@Override
	public Set<String> keySet()
	{
		return _ModuleSettingMap.keySet();
	}

	@Override
	public Setting<?> put(String key, Setting<?> value)
	{
		_ModuleSettingMap.put(key, value);
		return null;
	}

	@Override
	public void putAll(Map<? extends String, ? extends Setting<?>> m)
	{
	}

	@Override
	public Setting<?> remove(Object key)
	{
		return _ModuleSettingMap.remove(key);
	}

	@Override
	public int size()
	{
		return _ModuleSettingMap.size();
	}

	@Override
	public Collection<Setting<?>> values()
	{
		return _ModuleSettingMap.values();
	}

	@Override
	public String toString()
	{
		return JSONObject.fromObject(_ModuleSettingMap).toString();
	}
}
